<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
<title>物流公司-注册</title>
<link rel="stylesheet" href="./../../layui/2.3.0/css/layui.css?t=1527693307626"  media="all">
<style>
#bizlicense,#repFront,#repBack{
width:250px;
height:200px;
}
.layout1_foot{
	position:relative;
	bottom:0px;
	text-align:center;
	color:#fff;
	width: 100%;
    height: 46px;
    background: #242527;
}
</style>
 </head>
<body>
<ul class="layui-nav">
  <li class="layui-nav-item"><a href=""> <img th:attr="src=@{/images/logo.jpeg}" style="width:100px;height:30px;"></a></li>
  
</ul>
<div class="layui-container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>上传证件</legend>
</fieldset>
<form class="layui-form" action="">
	<div class="layui-row">
	  	<div class="layui-upload layui-col-xs4">
	  	<button type="button" class="layui-btn" id="bizlicenseBtn"><i class="layui-icon"></i>上传企业营业执照</button>
	  	<input type="hidden" name="bizlicense" th:value="${bizlicense}">
	  	<div class="layui-upload-list">
	    	<img class="layui-upload-img" id="bizlicense" th:src="@{/reg/image/bizlicense}">
	    	<p id="bizlicenseText"></p>
	  	</div>
		</div> 
	 	<div class="layui-upload layui-col-xs4"  >
	  		<button type="button" class="layui-btn" id="repFrontBtn"><i class="layui-icon"></i>上传企业法人身份证件正面</button>
	  		<input name="repFront" type="hidden" th:value="${repFront}">
	  		<div class="layui-upload-list ">
	   			 <img class="layui-upload-img" id="repFront" th:src="@{/reg/image/repIdCardFront}">
	   			 <p id="repFrontText"></p>
	  		</div>
		</div>  
	  <div class="layui-upload layui-col-xs4" >
	  	<button type="button" class="layui-btn" id="repBackBtn"><i class="layui-icon"></i>上传企业法人身份证件背面</button>
	  	<input name="repBack" type="hidden" th:value="${repBack}">
	  	<div class="layui-upload-list ">
	    	<img class="layui-upload-img" id="repBack" th:src="@{/reg/image/repIdCardBack}">
	    	<p id="repBackText"></p>
	  	</div>
	  </div>
	</div>
	<div class="layui-form-item" style="text-align:center;margin-top:70px;padding-left:450px;">
		<div class="layui-input-inline" >
		   <button style="background:#009688" id="prevBtn" type="button" class="layui-btn layui-btn-lg layui-btn-warm layui-btn-fluid">上一步</button>
		   </div>
		  <div class="layui-input-inline" >
		   <button style="background:#009688" id="nextBtn" type="button" class="layui-btn layui-btn-lg layui-btn-warm layui-btn-fluid">下一步</button>
		   </div>
	 </div>
 </form>
</div>
<div class="layout1_foot" style="line-height:45px;top:130px;">
<p>四川锦云运输有限公司<label style="margin-left:10px;">粤ICP备14091972号</label></p>
</div>

<script src="./../../layui/2.3.0/layui.all.js" charset="utf-8"></script>
<script>
layui.use('upload', function(){
	 var $ = layui.jquery,layer = layui.layer
  ,upload = layui.upload,prevBtn=$("prevBtn"),nextBtn=$("#nextBtn");
  prevBtn.click(function(){
	  window.location.href="./../trans/page1.html"
  });
  nextBtn.click(function(){
	  if(!$("input[name=bizlicense]").val()){
		 return layer.msg("营业执照没有上传");
	  }
	  if(!$("input[name=repFront]").val()){
			 return layer.msg("法人正面照没有上传");
		}
	  if(!$("input[name=repBack]").val()){
			 return layer.msg("法人背面照没有上传");
		}
	  window.location.href="./../trans/page3.html"
  });
  //普通图片上传
  var uploadBizlicense = upload.render({
    elem: '#bizlicenseBtn'
    ,url: '../upload/bizlicense'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#bizlicense').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(!res.success){
    	  if(res["msg"]="请重新验证"){
    		 return window.location.href="./../trans/page1.html"
    	  }
      }else{
    	  layer.msg('上传成功');
    	  $("input[name=bizlicense]").val(res["data"]["socialCreditCode"]);
      }
      
    }
    ,error: function(){
    	 return layer.msg('上传失败');
    }
  });
  
  var uploadRepFront = upload.render({
	    elem: '#repFrontBtn'
	    ,url: '../upload/repIdCardFront'
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	        $('#repFront').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(!res.success){
	    	  if(res["msg"]="请重新验证"){
	    		  window.location.href="./../supplier/page1.html"
	    	  }
	        return layer.msg('上传失败');
	      }else{
	    	  $("input[name=repFront]").val(res["data"]["idNo"]);
	    	  layer.msg('上传成功');
	      }
	      
	      //上传成功
	    }
	    ,error: function(){
	    	return layer.msg('上传失败');
	    }
	  });
  
  var uploadRepBack = upload.render({
	    elem: '#repBackBtn'
	    ,url: '../upload/repIdCardBack'
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
	        $('#repBack').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(!res.success){
	    	  if(res["msg"]="请重新验证"){
	    		  return window.location.href="./../trans/page1.html"
	    	  }
	      }else{
	    	  $("input[name=repBack]").val("ok");
	    	  layer.msg('上传成功');
	      }
	    }
	    ,error: function(){
	    	return layer.msg('上传失败');
	    }
	  });
});
</script>
</body>
</html>